package reflect;

import day05.MethodDemo1;
import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

/**
 * 验证sayHello、sayHi...方法是否被AutoRunMethod标注;
 */
public class Demo11Reflect {
    public static void main(String[] args) throws Exception {
        Class cls = Class.forName("reflect.Person");
        //1.确认sayHello方法是否被标注;
        Method method = cls.getMethod("sayHello");
        boolean mark1 = method.isAnnotationPresent(AutoRunMethod.class);
        System.out.println("sayHello方式是否被标注:" + mark1);
        //2.其他的方式确实同理;
    }
}
